home *** CD-ROM | disk | FTP | other *** search
- /*
- This a called 'Make' and is a much simplified version of
- the make utility on UNIX (a trademark or something of AT&T)
- written using the Lattice C compile
- for the IBM Personal Computer. The Lattice package is
- available from Lifeboat Assoc. 1651 Third Avenue
- New York, NY 10128 .
-
- 'Make' takes a file of dependencies (a 'makefile') and
- decides what commands have to be executed to bring the files
- up to date. These commands are either executed directly from
- 'Make' or written to the standard output without executing
- them.
-
- 'Makefile' format:
- - There must be a 'makefile'; you can't take input from the
- standard input.
- - The default name of the 'makefile' is 'MAKEFILE' on the
- default disk. Different 'makefiles' can be specified using
- the '-f' option on the command line. If the '-f' option is
- used, the default 'makefile' is not processed.
- - Any blank lines in the 'makefile(s)' are ignored.
- - A line in a 'makefile' that starts with a tab character is
- a 'howto' line and consists of a command name followed by
- arguments. The command name must be a file name, e.g.
- 'cc'. When commands are executed, the PATH environment
- variable is used to find the command, in (hopefully) the
- same manner as DOS does. 'Howto' lines apply to the most
- recently preceding 'dependency' line. It is an error for
- a 'howto' line to precede the first 'dependency' line.
- - Any other non-blank line is a 'dependency' line. 'Dependency'
- lines consist of a filename followed by a (possibly empty) list
- of dependent filenames.
-
- Operation:
- Syntax:
- make [filename] [-f makefilename] [-i] [-n]
- -i means continue even if an error is encountered while
- executing a command.
- -n means don't execute the commands, just write the ones that
- should be executed to the standard output. This is useful
- for creating batch files, for example.
- -f specifies that the following argument is the name of a makefile
- to be used instead of the default (MAKEFILE).
- All arguments may be repeated and relative position of the
- arguments is not important. If multiple definitions of a file
- are found, only the first one is significant.
-
- First, 'Make' reads all of the makefiles. It then proceeds through
- all of the filename arguments, 'making' each one in turn. A file
- is remade if it is out of date with respect to the files it depends
- on or is non-existent. Dependencies are processed in a 'tree' fashion,
- so that the lowest-order files are remade first.
-
- 'Make' cannot execute DOS built-in commands e.g. 'cd' or 'dir'.
- 'Make' uses the first 20k or so after the resident portion of DOS.
- all definitions and howto's are stored in dynamically allocated struct's.
- Any executed commands are loaded above 'Make' in memory.
-
- 'Make' REQUIRES DOS 2.0 (or higher?).
-
-
- The code is a little kludgy in places.
-
- No guarantees or warranties of any kind: I think it works and
- I use it.
-
- Any suggestions for improvements gratefully accepted.
-
- I believe that commercial versions exist. I also beleive that they
- would be superior to this.
-
- version 2.0 comments:
- This program was converted to Lattice 'C' ver 2.11 on 15 jun 84.
- This allowed the use of the lattice 'fork' command. The command
- will automatically search the path name specified to find the
- desired executable image. This also allows the use of image names
- with out the extension. ie 'lc1' instead of 'lc1.exe'. All of
- the assembler routines have been replaced with lattice dos calls.
-
- The Lattice version uses about 55k bytes less memory than the
- Desmet version. This is nice for the systems with already tight
- memory requirements.
- version 3 comments:
- The default makefile name is MAKEFILE not MAKEFILE.DAT.
- There now is a symbol processor to do substitiutions
- in the argument line.
- A symbol definition MUST begin with a $.
- An example follows.
- Fixed a bug-If a dependent file did not exist then make didn't
- work correctly.
- Checks to see if a command results in a non-zero return code.
- If so then aborts unless the -i flag is used.
-
- Any comments on this code should be directed to
- Jeffrey Spidle
- Systems Analyst
- Office of Continuing Education
- Iowa State University
- Ames, IA 50011
- or a message on one of the following BBS.
- Gene Plantz (312)887-4227
- Lynn Long (918)749-0718
- Bob Blackwell (319)363-3314
-
-
- */
-
-
- /*
- Written by John M Sellens, April, 1984
- Modified for Lattice C ver 2.11 by Jeff Spidle jun 15 84
-
- Code is all original except where indicated otherwise.
-
- Until August, 1984:
- jmsellens@watrose.UUCP
-
- 107 - 180 Brybeck Cres.
- Kitchener, Ontario
- N2M 5G4
-
- After August, 1984:
- c/o 1135 Lansdowne Ave. SW
- Calgary, Alberta
- T2S 1A4
-
- (c) Copyright 1984 John M Sellens
- Permission is granted to use, distribute and/or modify this code unless
- done for direct commercial profit. If you find these routines useful,
- modest contributions (monetary or otherwise) will be gratefully accepted.
- Author's name, address and this notice must be included in any copies.
-
- <TAB> = ASCII 09
- An example: To compile this program the following makefile was used
- $CFLAGS -ms -i/code/c/lc/
- make.exe make.obj
- <TAB>link /code/c/lc/s/cs+make,make,make,/code/c/lc/s/lcs -map
- make.obj make.c /code/c/lc/stdio.h
- <TAB>lc1 make $CFLAGS -i/code/c/lc/s/ -n
- <TAB>lc2 make
-
- An explination: make.exe is a dependent file. Is is dependent on
- make.obj. make.obj is dependent on make.c and stdio.h. If the
- following command is issued:MAKE make.exe then make will
- check to see if either make.c or stdio.h has a newer date&time
- than make.obj. if so then the 2 compile instructions are issued.
- then the link instruction will be issued. If only make.obj is
- newer than make.exe then only the link step would be executed.
-
- The symbol substitution will end up having the lc1 call look like
- lc1 make -ms -i/code/c/lc/ -i/code/c/lc/s/ -n
-
- Hints: Dependencies can be in any order. Make will resolve them
- correctly.
-
- How to lines must begin with a <TAB> not just 7 spaces.
-
- Symbol definition lines must start with a $.
-
- Symbols cannot have other symbols in their definition.
-
- A symbol may have a max of 39 characters.
-
- The equate for a symbol may be up to 80 characters.
-
- You may have an unlimited(within reason) number of
- symbols.
-
- A symbol that is not defined will be copied to the
- output line. ie
- lc2 $TEST
- with $TEST not defined will create the command
- lc2 $TEST
-
- Symbols are case specific. upper and lower case are significant.
-
- The command line must specify what file you wish to
- make. You may have more than one set of file definitions
- in a makefile. If you do you may run out of memory. I
- haven't run into this yet but I suppose it is possible.
-
- If a command returns an error-code (ERRORLEVEL) not equal
- to zero then MAKE thinks that there was an error. MAKE
- will abort processing unless the -i (ignore errors) flag
- is used.
-
- Any suggestions or improvements will be much appreciated. I
- am next going to try to put definable symbols for substitution
- in a makefile next aka UNIX-MAKE. So we will see what happens.
- */
-